import request from '@/utils/request'
/*
  车辆管理
*/
// 获取车辆类型分页数据
export const initTruckType = (params) => {
  return request({
    method: 'get',
    url: '/truckType/page',
    params
  })
}
// 新增车辆类型
export const addTruckType = (data) => {
  return request({
    method: 'post',
    url: '/truckType',
    data
  })
}
// 删除车辆类型
export const delTruckType = (id) => {
  return request({
    method: 'delete',
    url: '/truckType/' + id
  })
}
// 车辆详细类型
export const getDetailType = (id) => {
  return request({
    method: 'get',
    url: '/truckType/' + id,
    params: {
      0: id
    }
  })
}
// 编辑车辆类型
export const editTruckType = (data) => {
  return request({
    method: 'put',
    url: '/truckType/' + data.id,
    data
  })
}
/*
  车辆列表
*/
// 获取车辆列表分页数据
export const initTruckList = (params) => {
  return request({
    method: 'get',
    url: '/truck/page',
    params
  })
}
// 车辆状态计数
export const getTruckCount = () => {
  return request({
    method: 'get',
    url: '/count'
  })
}
// 新增车辆
export const addTruck = (data) => {
  return request({
    method: 'post',
    url: '/truck',
    data
  })
}
// 获取所有车辆类型
export const getAllTruckType = (data) => {
  return request({
    method: 'get',
    url: '/truckType/simple',
    data
  })
}
// 车辆详情
export const getTruckDetail = (id) => {
  return request({
    method: 'get',
    url: '/truck/' + id,
    params: {
      0: id
    }
  })
}
// 更新车辆详情
export const editTruckDetail = (data) => {
  return request({
    method: 'put',
    url: '/truck/' + data.id,
    data
  })
}
// 启用车辆
export const enableTruck = (id) => {
  return request({
    method: 'put',
    url: '/enable/' + id
  })
}
// 听用车辆
export const stopTruck = (id) => {
  return request({
    method: 'put',
    url: '/disable/' + id
  })
}
// 配置司机信息
export const getBindDrivers = (id) => {
  return request({
    method: 'get',
    url: '/bindingDrivers/' + id,
    params: {
      0: id
    }
  })
}
// 回车登记表格
export const initTruckReturn = (data) => {
  return request({
    method: 'post',
    url: '/truck-return-register/pageQuery',
    data
  })
}
// 回单查看
export const getReturnOrder = (id) => {
  return request({
    method: 'get',
    url: '/truck-return-register/detail/' + id,
    params: {
      0: id
    }
  })
}
